const express = require('express');
const expressStatic = require( 'express-static' );
var users = {
    'zhangsan':'123',
    'lisi':'456'
};
var server = express();
server.listen(8080);

server.post('/login',function(req,res){
    var user = req.query['user'];
    var pwd = req.query['pwd'];
    if( users[user] == null )
    {
        res.send({status:false,msg:'用户不存在'});
    }else{
        if( users[user] != pwd )
        {
            res.send({status:false,msg:'密码错误'});
        }else
        {
            res.send({status:true,msg:'登录成功'});
        }
    }
    
});

server.use( expressStatic('./www') );